package com.example.yuejianapp14.Activity.Activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.yuejianapp14.Activity.Adapter.ClassAdapter;
import com.example.yuejianapp14.Activity.Adapter.VideoAdapter;
import com.example.yuejianapp14.Activity.JavaBean.Video1;
import com.example.yuejianapp14.Activity.JavaBean.class1;
import com.example.yuejianapp14.Activity.Listener.ClassListener;
import com.example.yuejianapp14.Activity.Listener.VideoListener;
import com.example.yuejianapp14.Activity.Model.ClassModel;
import com.example.yuejianapp14.Activity.Model.VideoModel;
import com.example.yuejianapp14.R;

import java.util.List;

public class Video1Activity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private List mDataList;
    private View view;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);
        getData();
        initRecyclerView();
    }

    VideoListener videoListener = new VideoListener() {
        @Override
        public void onResponse(List<Video1> beanList) {
            mDataList=beanList;
            VideoAdapter adapter = new VideoAdapter(Video1Activity.this,mDataList);
            recyclerView.setAdapter(adapter);
        }

        @Override
        public void onFail(String msg) {

        }
    };

    private void getData() {
        VideoModel videoModel =new VideoModel();
        videoModel.allVideo(videoListener);
    }

    private void initRecyclerView() {
        recyclerView = (RecyclerView)findViewById(R.id.rv_video1);
        recyclerView.setLayoutManager(new LinearLayoutManager(Video1Activity.this));
        recyclerView.setItemAnimator(new DefaultItemAnimator());
    }




}
